#include "CDesign.h"

CDesign* CDesign::singleton = 0;

CDesign::CDesign()
{
    this->i = 0;
    this->tmp = 0;
    this->is_changed = false;
}

CDesign::~CDesign()
{
}

void CDesign::change_color_widget(QWidget *w)
{
    if(this->i == 0) // Herbe
        w->setStyleSheet("background-color:#4F3A19; color:white;");

    else if(this->i == 1) // Fer
        w->setStyleSheet("background-color:#6E6B61; color:white;");

    else if(this->i == 2)// Sable
        w->setStyleSheet("background-color:#EAF370; color:#453215;");
}

void CDesign::change_color_button(QPushButton *p)
{
    if(this->i == 0) // Herbe
        p->setStyleSheet("QPushButton {background-color:#17B53B; border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px;} QPushButton:pressed {background-color:#DBFEC1; color:#17B53B; border-style:inset;}");

    else if(this->i == 1) // Fer
        p->setStyleSheet("QPushButton {background-color:#50504B; border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px;} QPushButton:pressed {background-color:white; color:#50504B; border-style:inset;}");

    else if(this->i == 2)// Sable
        p->setStyleSheet("QPushButton {background-color:#FFD34C; border-style:outset; border-radius:10px; border-color:#453215; border-width:2px; padding:6px;} QPushButton:pressed {background-color:#F8FEC1; color:#FFD34C; border-style:inset;}");
}

void CDesign::change_color_label(QLabel *l)
{
    if(this->i == 0) // Herbe
        l->setStyleSheet("color:#17B53B;");

    else if(this->i == 1) // Fer
        l->setStyleSheet("color:white;");

    else if(this->i == 2) // Sable
        l->setStyleSheet("color:#453215;");
}

void CDesign::change_color_label_border(QWidget *l)
{
    if(this->i == 0) // Herbe
        l->setStyleSheet("border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px");

    else if(this->i == 1) // Fer
        l->setStyleSheet("border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px");

    else if(this->i == 2)// Sable
        l->setStyleSheet("border-style:outset; border-radius:10px; border-color:#453215; border-width:2px; padding:6px");
}

void CDesign::change_color_text(QTextEdit *t)
{
    if(this->i == 0) // Herbe
        t->setStyleSheet("color: #453215; background-color:#DBFEC1; border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px");

    else if(this->i == 1) // Fer
        t->setStyleSheet("color: black; background-color:#E4E5E4; border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px");

    else if(this->i == 2) // Sable
        t->setStyleSheet("background-color:#F8FEC1; border-style:outset; border-radius:10px; border-color:#453215; border-width:2px; padding:6px");
}

void CDesign::change_color_line(QLineEdit *e)
{
    if(this->i == 0) // Herbe
        e->setStyleSheet("background-color:#DBFEC1; color:#453215; border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px");

    else if(this->i == 1) // Fer
        e->setStyleSheet("background-color:#E4E5E4; color:#6E6B61; border-style:outset; border-radius:10px; border-color:white; border-width:2px; padding:6px");

    else if(this->i == 2) // Sable
        e->setStyleSheet("background-color:#F8FEC1; color:#453215; border-style:outset; border-radius:10px; border-color:#453215; border-width:2px; padding:6px");
}

void CDesign::change_color_bar(QProgressBar *b)
{
    if(this->i == 0) // Herbe
        b->setStyleSheet("QProgressBar {text-align:center; border-style:outset; border-radius:5px; border-color:white; border-width:2px;}  QProgressBar::chunk {background-color: #D73D3D;}");

    else if(this->i == 1) // Fer
        b->setStyleSheet("QProgressBar {text-align:center; border-style:outset; border-radius:5px; border-color:white; border-width:2px;}  QProgressBar::chunk {background-color: #05B8CC;}");

    else if(this->i == 2) // Sable
        b->setStyleSheet("QProgressBar {text-align:center; border-style:outset; border-radius:5px; border-color:#453215; border-width:2px;}  QProgressBar::chunk {background-color: #CD96CD;}");
}

void CDesign::change_color_box(QCheckBox *c)
{
    if(this->i == 0) // Herbe
        c->setStyleSheet("QCheckBox {spacing: 5px;} QCheckBox::indicator {width: 13px; height: 13px;} QCheckBox::indicator:unchecked {image: url(Pictures/Misc/checkbox_unchecked_white_white.png);} QCheckBox::indicator:checked {image: url(Pictures/Misc/checkbox_checked_white_white.png);}");

    else if(this->i == 1) // Fer
        c->setStyleSheet("QCheckBox {spacing: 5px;} QCheckBox::indicator {width: 13px; height: 13px;} QCheckBox::indicator:unchecked {image: url(Pictures/Misc/checkbox_unchecked_white.png);} QCheckBox::indicator:checked {image: url(Pictures/Misc/checkbox_checked_white.png);}");

    else if(this->i == 2) // Sable
        c->setStyleSheet("QCheckBox {spacing: 5px;} QCheckBox::indicator {width: 13px; height: 13px;} QCheckBox::indicator:unchecked {image: url(Pictures/Misc/checkbox_unchecked_brown.png);} QCheckBox::indicator:checked {image: url(Pictures/Misc/checkbox_checked_brown.png);}");
}

CDesign* CDesign::get_instance()
{
    if(!singleton)
    {
        singleton = new CDesign;
    }

    return singleton;
}

void CDesign::set_i(int _i)
{
    this->i = _i;
}

int CDesign::get_i()
{
    return this->i;
}

void CDesign::set_tmp(int _tmp)
{
    this->tmp = _tmp;
}

int CDesign::get_tmp()
{
    return this->tmp;
}

void CDesign::set_changed(bool _change)
{
    this->is_changed = _change;
}

bool CDesign::get_changed()
{
    return this->is_changed;
}
